var should = require('should');
var techHandler = require('../../../app/servers/user/handler/techHandler');
var config = require('../../config');
var configUtil = require('../../../app/util/configUtil');
var analyze = require('kc-analyze');
var buildModel = require('../../../app/models/buildModel');
var buildType = require('../../../app/consts/buildType');

suite('测试techHandler', function () {
    setup(function (done) {
        var analyze_config = configUtil.load('analyze');
        var game_config = configUtil.load('game');
        analyze.initialize({
            host: analyze_config.host,
            server_id: game_config.server_id
        });
        done();
    });

    // suite('init_tech_data', function () {
    //     test('初始化科技相关数据', function (done) {
    //         buildModel.getByRoleId(config.role_id, function (err, model) {
    //             var academy_build = model.getBuildByType(buildType.ACADEMY);
    //             var academy_lvl = academy_build.getLv();
    //             while (academy_lvl < 10) {
    //                 academy_build.upgrade();
    //                 academy_lvl = academy_build.getLv();
    //                 //console.log("up academy_lvl=", academy_lvl);
    //             }
    //             model.save();
    //             done();
    //         });
    //     });
    // });

    suite('call upTech()', function () {
        test('升级科技', function (done) {
            var msg = {};
            msg.tech_id = 101;
            var session = {};
            session.uid = config.role_id;

            var tech_handler = new techHandler();
            tech_handler.upTech(msg, session, function (err, res) {
                console.log("res:", res);
                done();
            });
        });
    });

    // suite('call directUp()', function () {
    //     test('秒升科技', function (done) {
    //         var msg = {};
    //         msg.tech_id = 101;
    //         var session = {};
    //         session.uid = config.role_id;

    //         var tech_handler = new techHandler();
    //         tech_handler.directUp(msg, session, function (err, res) {
    //             //console.log("res:", res);
    //             done();
    //         });
    //     });
    // });

    // suite('call list()', function () {
    //     test('查询科技列表1', function (done) {
    //         var msg = {
    //             tech_class: 1
    //         };
    //         var session = {};
    //         session.uid = config.role_id;

    //         var tech_handler = new techHandler();
    //         tech_handler.list(msg, session, function (err, res) {
    //             done();
    //         });
    //     });
    // });

    // suite('call list()', function () {
    //     test('查询科技列表2', function (done) {
    //         var msg = {
    //             tech_class: 2
    //         };
    //         var session = {};
    //         session.uid = config.role_id;

    //         var tech_handler = new techHandler();
    //         tech_handler.list(msg, session, function (err, res) {
    //             done();
    //         });
    //     });
    // });
});
